<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');?>
<div id="closeParentTime" style="display:none"></div>
<script type="text/javascript">
	window.top.$('#display_center_id').css('display','none');
	function check_repeat_listorders(){
    	var listorders = new Array();
    	var list_flag = 0;
    	$(".list_orders").each(function(i){
    		listorders[i] = $(this).val();
        });
    	var nary=listorders.sort(); 
    	for(var i=0;i<listorders.length;i++){
        	if (nary[i]==nary[i+1]){ 
     		   alert("排序字段不能出现重复值："+nary[i]); 
     		   list_flag = 1;
        	}
    	}
    	if(list_flag!=1){
    		myform.action='?m=admin&c=appmemu&a=listorder&dosubmit=1&steps=<?php echo $steps;?>';myform.submit();
        } else {
        	window.location.reload();
        }
    }
</script>
<div class="pad-10">
<div id="searchid" style="">
<form name="searchform" action="" method="get" >
<input type="hidden" value="admin" name="m">
<input type="hidden" value="appmemu" name="c">
<input type="hidden" value="init" name="a">
<input type="hidden" value="1" name="search">
<input type="hidden" value="<?php echo $pc_hash;?>" name="pc_hash">
<table width="100%" cellspacing="0" class="search-form">
    <tbody>
		<tr>
		<td>
		<div class="explain-col">		
				<?php echo L('app_name')?>：<input name="title" type="text" value="<?php echo $_GET['title']?>" class="input-text" />&nbsp;&nbsp;&nbsp;<?php echo L('user_type')?>：<?php echo form::select(array('1'=>'普通用户','2'=>'模特','3'=>'经纪人','4'=>'商户'), $_GET['user_type'], 'name="user_type"', '请选择')?>&nbsp;&nbsp;&nbsp;
				<input type="submit" name="search" class="button" value="<?php echo L('search');?>" /><a style="float:right;" href="javascript:;" onclick="refreshData(11);"><em>刷新数据</em></a>
	</div>
		</td>
		</tr>
    </tbody>
</table>
</form>
</div>
<form name="myform" id="myform" action="" method="post" >
<div class="table-list">
    <table width="100%">
        <thead>
            <tr>
			<th width="16" align="center"><input type="checkbox" value="" id="check_box" onclick="selectall('id[]');"></th>
			<th width="40" align='center'><?php echo L('listorder');?></th>
            <th width="70" align="center">ID</th>
			<th width="200" align="center"><?php echo L('app_name');?></th>
			<th width="120" align="center"><?php echo L('image_url');?></th>
			<th width="120" align="center"><?php echo L('user_type');?></th>
			<th width="70" align="center"><?php echo L('is_selected');?></th>
            <th width="100" align="center"><?php echo L('config_id');?></th>
            <th width="150" align="center"><?php echo L('create_time');?></th>
            <th align="center" width="100">上次编辑者</th>
			<th width="200" align="center"><?php echo L('operations_manage');?></th>
            </tr>
        </thead>
<tbody>
    <?php
	if(!empty($lists)) {
		
		foreach ($lists as $r) {
	?>
        <tr>
		<td align="center"><input class="inputcheckbox " name="id[]" value="<?php echo $r['id'];?>" type="checkbox"></td>
		<td align='center'><input name='listorders[<?php echo $r['id'];?>]' type='text' size='3' value='<?php echo $r['sort'];?>' class='input-text-c list_orders'></td>
		<td align='center' ><?php echo $r['id'];?></td>
		<td align='center'><?php echo $r['name'];?></td>
		<td align='center'><?php if ($r['image_url']){ ?><img src="<?php echo $r['image_url'];?>" height="60"/><?php }else{echo '<font color="red">（未设置）</font>';}?></td>
		<td align='center'><?php echo ($r['user_type'] == 1?'普通用户':($r['user_type'] == 2?'模特':($r['user_type'] == 3?'经纪人':'商户')));?></td>
		<td align='center'><?php echo ($r['is_selected'] == 0?'否':($r['is_selected'] == 1?'是':'<font color="red">(未设置)</font>'));?></td>
		<td align='center'><?php echo $r['config_id'];?></td>
		<td align='center'><?php echo $r['create_time']?></td>
		<td align='center'><?php echo $adminInfo[$r['updated_by']];?></td>
		<td align='center'>
		<a href="javascript:edit('<?php echo $r['id']?>','<?php echo addslashes($r['name']);?>')"><?php echo L('edit');?></a>
		 | <a href="?m=admin&c=appmemu&a=delete&id=<?php echo $r['id']?>" onClick="return confirm('<?php echo L('confirm', array('message' => new_addslashes($r['name'])))?>')"><?php echo L('delete')?></a></td>

	</tr>
     <?php }
	} else {
		echo "<tr><td colspan='10' style='color:red;font-size:18px;text-align:center;'><span>暂无数据！</span></td></tr>";
	}
	?>
</tbody>
     </table>
    <div class="btn"><label for="check_box"><?php echo L('selected_all');?>/<?php echo L('cancel');?></label>
		<input type="hidden" value="<?php echo $pc_hash;?>" name="pc_hash">
		<input type="button" class="button" value="<?php echo L('listorder');?>" onclick="check_repeat_listorders();"/>
		<input type="button" class="button" value="<?php echo L('delete');?>" onclick="myform.action='?m=admin&c=appmemu&a=delete&dosubmit=1&steps=<?php echo $steps;?>';return confirm_delete()"/>
	</div>
    <div id="pages"><?php echo $pages;?></div>
</div>
</form>
</div>
<script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>cookie.js"></script>
<script type="text/javascript"> 
<!--
function edit(id, name) {
	window.top.art.dialog({id:'edit'}).close();
	window.top.art.dialog({title:'修改《'+name+'》',id:'edit',iframe:'?m=admin&c=appmemu&a=edit&pc_hash=<?=$_SESSION["pc_hash"]?>&id='+id,width:'580',height:'300'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
}
function confirm_delete(){
	if(confirm('<?php echo L('confirm_delete', array('message' => L('selected')));?>')) $('#myform').submit();
}

//-->
</script>
</body>
</html>